
include ../Makefile.Res
Version:=2.6.19
ModuleName:=openswan

Object:=openswan.tgz
ObjectDir:=$(ModuleName)-$(Version)
ObjectSource:=$(ModuleName)-$(Version).tar.gz

XL2TP:=xl2tpd.tmp
XL2TP_Version:=1.2.3
XL2TP_Name:=xl2tpd
XL2TP_Dir:=$(XL2TP_Name)-$(XL2TP_Version)
XL2TP_Source:=$(XL2TP_Name)-$(XL2TP_Version).tar.gz

PPTP:=pptp.tmp
PPTP_Version:=1.7.2
PPTP_Name:=pptp
PPTP_Dir:=$(PPTP_Name)-$(PPTP_Version)
PPTP_Source:=$(PPTP_Name)-$(PPTP_Version).tar.gz

PPTPD:=pptpd.tmp
PPTPD_Version:=1.3.4
PPTPD_Name:=pptpd
PPTPD_Dir:=$(PPTPD_Name)-$(PPTPD_Version)
PPTPD_Source:=$(PPTPD_Name)-$(PPTPD_Version).tar.gz

Config:=
Depend:=

.PHONY: all clean dist_clean

all:$(Object) 

$(Object):$(XL2TP) $(PPTP) $(PPTPD) $(ObjectSource) $(Depend)
	tar -xzf $(ObjectSource)
	cd $(ObjectDir);$(MAKE) programs
	$(MAKE) -C $(ObjectDir) install DESTDIR=`pwd`/
	rm -rf usr/local/man usr/local/share
	cp -rf etc/rc.d/init.d/ipsec usr/local/libexec/ipsec/setup
	cp -rf ipsec.secrets ipsec.conf etc/
	$(g_STRIP)
	tar -czf $(Object) usr etc var

$(XL2TP):$(XL2TP_Source)
	tar xzf $(XL2TP_Source)
	$(MAKE) -C $(XL2TP_Dir)
	$(MAKE) -C $(XL2TP_Dir) install DESTDIR=`pwd`/
	echo > $(XL2TP)

$(PPTP):$(PPTP_Source)
	tar xzf $(PPTP_Source)
	$(MAKE) -C $(PPTP_Dir)
	$(MAKE) -C $(PPTP_Dir) install DESTDIR=`pwd`/
	echo > $(PPTP)

$(PPTPD):$(PPTPD_Source)
	tar xzf $(PPTPD_Source)
	cd $(PPTPD_Dir) ; ./configure
	$(MAKE) -C $(PPTPD_Dir)
	$(MAKE) -C $(PPTPD_Dir) install DESTDIR=`pwd`/
	echo > $(PPTPD)

test:$(Object)
	scp $(Object) $(TestServer):/packages
	ssh $(TestServer) tar xzvf /packages/$(Object)

clean:
	rm -rf $(Object) usr var etc *.tmp

dist_clean:clean
	rm -rf $(ObjectDir) $(ObjectSource) *.tar.gz $(XL2TP_Dir) $(PPTP_Dir) $(PPTPD_Dir)
	
